<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>浮动</title>
    <style>
        .img{
            width: 300px;
            height: 200px;
            /*background-color: pink;*/
            margin: 10px;
            float: left;
            /*background-size: contain;*/
        }
        #div-one{
            background-image: url("image/1.jpg");
            background-size: 300px 200px;
        }
        #div-two{
            background-image: url("image/2.jpg");
            background-size: 300px 200px;
        }
        #div-three{
            background-image: url("image/4.jpg");
            background-size: 300px 200px;
        }
        #div-four{
            background-image: url("image/1.jpg");
            background-size: 300px 200px;
        }
        .img-text{
            width: 300px;
            height: 200px;
            background-color: pink;
        }
    </style>
</head>
<body>
<div class="img" id="div-one"></div>
<div class="img" id="div-two"></div>
<div class="img" id="div-three"></div>
<div class="img" id="div-four"></div>
<!--<div class="img-text"></div>-->
</body>
</html>